<!DOCTYPE HTML>
<html lang="en">
	<head>
		<title>Axis Zoom Control</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge">
		<style type="text/css">
			@import "../../../../dojo/resources/dojo.css";
			@import "../../../../dijit/themes/claro/claro.css";
			@import "../../../../dijit/tests/css/dijitTests.css";
			@import "../../../form/resources/RangeSlider.css";
			#hrXAxisSlider .dijitSliderProgressBar{
				height: 12px;
				overflow: visible;
				margin-top: -5px;
			}
		</style>
		<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: false, async: true"></script>
		<script type="text/javascript">
			var zoomXAxis;
			require([
				"dojo/parser",
				"dojo/dom",
				"dojox/charting/Chart",
				"dojox/charting/action2d/Tooltip",
				"dojox/charting/action2d/Magnify",
				"dojox/charting/themes/PlotKit/orange",
				// Used indirectly/by the parser.
				"dojox/charting/axis2d/Default",
				"dojox/charting/axis2d/Log",
				"dojox/charting/plot2d/Lines",
				"dojox/charting/plot2d/Grid",
				"dojox/form/RangeSlider",
				"dijit/form/HorizontalRuleLabels",
				"dijit/form/HorizontalRule",
				"dojo/domReady!"
			], function(parser, dom, Chart, Tooltip, Magnify, orangePlotKit){
				zoomXAxis = function(){
					var a = Math.pow(10, arguments[0][0] / 25 - 1),
						b = Math.pow(10, arguments[0][1] / 25 - 1);
					chart.zoomIn("x", [a, b]);
					dom.byId('minValue').value = a;
					dom.byId('maxValue').value = b;
				}				

				parser.parse();
				
				chart = new Chart("chart");
				chart.setTheme(orangePlotKit);
				chart.addAxis("x", {type: "Log",
					fixLower: "minor", natural: true, stroke: "grey",
					majorTick: {stroke: "black", length: 4},
					minorTick: {stroke: "gray", length: 2}});
				chart.addAxis("y", {vertical: true, type: "Log",
					min: 1, max: 1000, stroke: "grey",
					majorTick: {stroke: "black", length: 4},
					minorTick: {stroke: "gray", length: 2}});
				chart.addPlot("default", {type: "Lines", markers: true});
				chart.addSeries("Series A", [
					 8,  7,  3,  2,  5,  7,  9, 10,  2, 10,
					14, 16, 18, 13, 16, 15, 20, 19, 15, 12,
					24, 20, 20, 26, 28, 26, 28, 29, 24, 29,
					31, 35, 37, 31, 35, 37, 37, 36, 31, 30,
					50, 49, 42, 46, 44, 40, 47, 43, 48, 47,
					51, 52, 52, 51, 54, 57, 58, 50, 54, 51,
					62, 68, 67, 62, 62, 65, 61, 66, 65, 62,
					74, 78, 78, 77, 74, 74, 72, 74, 70, 78,
					84, 83, 85, 86, 86, 89, 89, 85, 86, 86,
					98, 97, 93, 91, 92, 92, 99, 93, 94, 92
				]);
				chart.addPlot("grid", {type:"Grid", hMinorLines:true});
				new Tooltip(chart, "default");
				new Magnify(chart, "default");
				chart.render();
			});
		</script>
	</head>
	<body class="claro">
		<h1>Axis Zoom Control</h1>
		 Try to drag the slider endpoints and the bar to zoom X axis of the chart.
		<div style="margin: 20px">
			<div id="chart" style="width: 800px; height: 400px;"></div>
			<div id="hrXAxisSlider"
				data-dojo-props="discreteValues: 5, onChange: zoomXAxis, intermediateChanges: false, showButtons: false, value: [0,100]"
				data-dojo-type="dojox/form/HorizontalRangeSlider"
				style="width: 748px; margin-left: 40px">
				<ol data-dojo-type="dijit/form/HorizontalRuleLabels" data-dojo-props="container: 'topDecoration', count: 5" style="height: 1.2em; font-size: 75%; color: gray;">
					<li>0.1</li><li>1</li><li>10</li><li>100</li><li>1000</li>
				</ol>
				<div data-dojo-type="dijit/form/HorizontalRule" data-dojo-props="container: 'topDecoration', count: 5"  count="5" style="height: 10px;"></div>
			</div>
		</div>
		<p>X Axis Lower Value:&nbsp;<input readonly id="minValue" size="10" value="0.1"/></p>
		<p>X Axis Upper Value:&nbsp;<input readonly id="maxValue" size="10" value="1000"/></p>
		<p>That's all Folks!</p>
	</body>
</html>
